{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests_html\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [],
   "source": [
    "from time import sleep\n",
    "from selenium import webdriver"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.common.desired_capabilities import DesiredCapabilities"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "opts = webdriver.ChromeOptions()\n",
    "opts.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错\n",
    "opts.add_argument('window-size=1920x3000') #指定浏览器分辨率\n",
    "opts.add_argument('--disable-gpu') #谷歌文档提到需要加上一这个属性来规避bug\n",
    "opts.add_argument('--hide-scrollbars')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver= webdriver.Chrome()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 打开微信公众号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get('https://mp.weixin.qq.com/')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 扫码登陆"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "element=driver.find_element_by_xpath('//*[@id=\"mp_header\"]/div/div/a')\n",
    "element.get_attribute('innerHTML')\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 打开导航栏"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "element=driver.find_element_by_xpath('//*[@id=\"menuBar\"]/li[2]/ul/li[1]/a')\n",
    "element.get_attribute('innerHTML')\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 图文管理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "新建图文 = driver.find_element_by_xpath('//*[@id=\"js_main\"]/div[3]/div[2]/div/div[1]/div/div[1]/div/div[1]/div[2]/ul/li[1]/a')\n",
    "新建图文.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'CDwindow-65C60CB820C5C035A9339B6EF75A20AB'"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "driver.current_window_handle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CDwindow-A5256077692726DEC21A785B0CE79AF2',\n",
       " 'CDwindow-65C60CB820C5C035A9339B6EF75A20AB']"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "driver.window_handles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-63-6c6d5ce6602d>:1: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[1])\n"
     ]
    }
   ],
   "source": [
    "driver.switch_to_window(driver.window_handles[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.switch_to.window(driver.window_handles[-1])\n",
    "hyperlink= driver.find_element_by_xpath('//*[@id=\"js_editor_insertlink\"]')\n",
    "hyperlink.get_attribute('innerHTML')\n",
    "hyperlink.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [],
   "source": [
    "choice_other = driver.find_element_by_xpath('//*[@id=\"vue_app\"]/div[2]/div[1]/div/div[2]/div[2]/form[1]/div[3]/div/div/p/div/button')\n",
    "choice_other.get_attribute('innerHTML')\n",
    "choice_other.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 搜索公众号\n",
    "keyword = \"中大南院文学与传媒系团总支学生会\"\n",
    "driver.find_element_by_xpath('//div[@class=\"weui-desktop-link-dialog\"]//div[@class=\"weui-desktop-search weui-desktop-form__input_clear\"]//span[@class=\"weui-desktop-form__input-wrp\"]/input').send_keys(keyword)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 点击搜索按钮\n",
    "driver.find_element_by_xpath('//div[@class=\"weui-desktop-link-dialog\"]//div[@class=\"weui-desktop-search weui-desktop-form__input_clear\"]//button[@class=\"weui-desktop-icon-btn weui-desktop-search__btn\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_xpath('//div[@class=\"weui-desktop-form__control-group\"]//div[@class=\"weui-desktop-search__panel\"]/ul/li[1]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "metadata": {},
   "outputs": [],
   "source": [
    "抓取 = driver.find_element_by_xpath('//div[@class=\"weui-desktop-media__list-wrp\"]')\n",
    "links = [i.get_attribute(\"href\")for i in driver.find_elements_by_xpath('//div[@class=\"weui-desktop-radio-group\"]//span[@class=\"weui-desktop-vm_default\"]//a')]\n",
    "info_str = 抓取.get_attribute('innerText')\n",
    "info = info_str.replace('\\t','s').replace('\\n','s').replace('sssss', 's').replace('ss', 's').split('s')[1:-1]\n",
    "title = info[::2]\n",
    "time = info[1::2]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_xpath('//div[@class=\"weui-desktop-pagination\"]//a').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "metadata": {},
   "outputs": [
    {
     "ename": "NoSuchElementException",
     "evalue": "Message: no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"vue_app\"]/div[2]/div[1]/div/div[2]/div[2]/form[1]/div[4]/div/div/div[3]/span[1]/a[2]\"}\n  (Session info: chrome=90.0.4430.212)\n",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNoSuchElementException\u001b[0m                    Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-181-e583c71df03f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     17\u001b[0m     \u001b[0mlinks_all\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlinks\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     18\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 19\u001b[1;33m     \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'//*[@id=\"vue_app\"]/div[2]/div[1]/div/div[2]/div[2]/form[1]/div[4]/div/div/div[3]/span[1]/a[2]'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclick\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     20\u001b[0m     \u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element_by_xpath\u001b[1;34m(self, xpath)\u001b[0m\n\u001b[0;32m    392\u001b[0m             \u001b[0melement\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'//div/td[1]'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    393\u001b[0m         \"\"\"\n\u001b[1;32m--> 394\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_element\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mby\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mXPATH\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mxpath\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    395\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    396\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mfind_elements_by_xpath\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mxpath\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mfind_element\u001b[1;34m(self, by, value)\u001b[0m\n\u001b[0;32m    974\u001b[0m                 \u001b[0mby\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mBy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCSS_SELECTOR\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    975\u001b[0m                 \u001b[0mvalue\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'[name=\"%s\"]'\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 976\u001b[1;33m         return self.execute(Command.FIND_ELEMENT, {\n\u001b[0m\u001b[0;32m    977\u001b[0m             \u001b[1;34m'using'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mby\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    978\u001b[0m             'value': value})['value']\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001b[0m in \u001b[0;36mexecute\u001b[1;34m(self, driver_command, params)\u001b[0m\n\u001b[0;32m    319\u001b[0m         \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcommand_executor\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdriver_command\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    320\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mresponse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 321\u001b[1;33m             \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merror_handler\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcheck_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    322\u001b[0m             response['value'] = self._unwrap_value(\n\u001b[0;32m    323\u001b[0m                 response.get('value', None))\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py\u001b[0m in \u001b[0;36mcheck_response\u001b[1;34m(self, response)\u001b[0m\n\u001b[0;32m    240\u001b[0m                 \u001b[0malert_text\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'alert'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'text'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    241\u001b[0m             \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0malert_text\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 242\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mexception_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mscreen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstacktrace\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    243\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    244\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_value_or_default\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdefault\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNoSuchElementException\u001b[0m: Message: no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"vue_app\"]/div[2]/div[1]/div/div[2]/div[2]/form[1]/div[4]/div/div/div[3]/span[1]/a[2]\"}\n  (Session info: chrome=90.0.4430.212)\n"
     ]
    }
   ],
   "source": [
    "pages = 50\n",
    "\n",
    "title_all = []\n",
    "time_all = []\n",
    "links_all = []\n",
    "\n",
    "for i in range(pages-2):\n",
    "    抓取 = driver.find_element_by_xpath('//div[@class=\"weui-desktop-media__list-wrp\"]')\n",
    "    links = [i.get_attribute(\"href\")for i in driver.find_elements_by_xpath('//div[@class=\"weui-desktop-radio-group\"]//span[@class=\"weui-desktop-vm_default\"]//a')]\n",
    "    info_str = 抓取.get_attribute('innerText')    \n",
    "    info = info_str.replace('\\t','s').replace('\\n','s').replace('sssss', 's').replace('ss', 's').split('s')[1:-1]\n",
    "    \n",
    "    title = info[::2]\n",
    "    time = info[1::2]\n",
    "    title_all.append(title)\n",
    "    time_all.append(time)\n",
    "    links_all.append(links)\n",
    "   \n",
    "    driver.find_element_by_xpath('//*[@id=\"vue_app\"]/div[2]/div[1]/div/div[2]/div[2]/form[1]/div[4]/div/div/div[3]/span[1]/a[2]').click()    \n",
    "    sleep(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "new_title=[]\n",
    "for x in title_all:\n",
    "    for y in x:\n",
    "        new_title.append(y)\n",
    "        \n",
    "new_time=[]\n",
    "for x in time_all:\n",
    "    for y in x:\n",
    "        new_time.append(y) \n",
    "        \n",
    "new_links=[]\n",
    "for x in links_all:\n",
    "    for y in x:\n",
    "        new_links.append(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "while '查看文章' in new_title:\n",
    "    new_title.remove('查看文章')\n",
    "while '' in new_time:\n",
    "    new_time.remove('')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "384"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(new_links)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "384 384 384\n"
     ]
    }
   ],
   "source": [
    "print(len(new_title),len(new_time),len(new_links))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>喜讯：我院团总支荣获2018年度中山大学南方学院优秀团总支</td>\n",
       "      <td>2018-05-29</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【人物专访•翁泳琦】迎难而上，锻炼自我</td>\n",
       "      <td>2018-05-29</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>我院2018年优秀学生专业实践团队评选大会顺利举行</td>\n",
       "      <td>2018-05-26</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>我院2018年优秀学生专业实践团队评选大会顺利举行</td>\n",
       "      <td>2018-05-25</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示</td>\n",
       "      <td>2018-05-25</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>379</th>\n",
       "      <td>我院2018年优秀学生专业实践团队评选大会顺利举行</td>\n",
       "      <td>2018-05-25</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>380</th>\n",
       "      <td>文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示</td>\n",
       "      <td>2018-05-25</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>381</th>\n",
       "      <td>文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示</td>\n",
       "      <td>2018-05-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>382</th>\n",
       "      <td>文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示</td>\n",
       "      <td>2018-05-23</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>383</th>\n",
       "      <td>【有人@你|2018级新生班主任报名时间延长一天！】</td>\n",
       "      <td>2018-05-23</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>384 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       title        time  \\\n",
       "0              喜讯：我院团总支荣获2018年度中山大学南方学院优秀团总支  2018-05-29   \n",
       "1                        【人物专访•翁泳琦】迎难而上，锻炼自我  2018-05-29   \n",
       "2                  我院2018年优秀学生专业实践团队评选大会顺利举行  2018-05-26   \n",
       "3                  我院2018年优秀学生专业实践团队评选大会顺利举行  2018-05-25   \n",
       "4    文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示  2018-05-25   \n",
       "..                                       ...         ...   \n",
       "379                我院2018年优秀学生专业实践团队评选大会顺利举行  2018-05-25   \n",
       "380  文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示  2018-05-25   \n",
       "381  文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示  2018-05-24   \n",
       "382  文学与传媒学院第十一次团员代表大会暨第十二次学生代表大会正式委员候选人名单公示  2018-05-23   \n",
       "383               【有人@你|2018级新生班主任报名时间延长一天！】  2018-05-23   \n",
       "\n",
       "                                                  link  \n",
       "0    http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "1    http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "2    http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "3    http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "4    http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "..                                                 ...  \n",
       "379  http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "380  http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "381  http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "382  http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "383  http://mp.weixin.qq.com/s?__biz=MjM5NDI5NjIwNQ...  \n",
       "\n",
       "[384 rows x 3 columns]"
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "info_dict = {\n",
    "    \"title\" : new_title,\n",
    "    \"time\" : new_time,\n",
    "    \"link\" : new_links\n",
    "}\n",
    "data_wenchaun = pd.DataFrame(info_dict)\n",
    "data_wenchaun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
